#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using tl = tuple < int, int, int >;
using vec = vector < int >;
using veg = vector < pii >;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 4e5 + 10;

int a[N], n;

namespace Trie {
	int ch[N << 5][2], ndn;
	void reset() { rep(i, 1, ndn) ch[i][0] = ch[i][1] = 0; ndn = 1; }
	void insert(int x) {
		int p = 1;
		per(i, 29, 0) {
			int &y = ch[p][x >> i & 1];
			if(!y) y = ++ndn; p = y;
		}
	}
	int getmn(int x) {
		int p = 1, res = 0;
		per(i, 29, 0) {
			if(ch[p][x >> i & 1]) p = ch[p][x >> i & 1];
			else res |= 1 << i, p = ch[p][!(x >> i & 1)]; 
		} return res;
	}
}

int solve(int bit, vec al) {
	if(al.size() == 0 || bit == -1) return 0;
	vec pot[2]; for(auto v : al) pot[v >> bit & 1].pb(v);
	if(pot[1].size() & 1) {
		//cerr << "!" << bit << endl;
		Trie :: reset();
		for(auto v : pot[0]) Trie :: insert(v);
		int res = 2e9;
		for(auto &v : pot[1]) res = min(res, Trie :: getmn(v ^ (1 << bit)));
		return res | 1 << bit;
	} else {
		for(auto &v : pot[1]) v ^= 1 << bit;
		return max(solve(bit - 1, pot[0]), solve(bit - 1, pot[1]));
	}
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	n = in; rep(i, 1, n * 2) a[i] = in;
	vec al; rep(i, 1, n * 2) al.pb(a[i]);
	printf("%d\n", solve(29, al));
	return 0;
}
